import {baseUrl, getUploadConfig} from '@/config/env';
import startSearchModel from "@/config/startSearchModel";

const uploadConfig = getUploadConfig()
export default () => {
    return {
        index: true,
        submitText: '保存',
        size: 'default',
        labelWidth: 120,
        menuType: 'menu',
        align: 'center',
        menuAlign: 'center',
        menuPosition: "right",
        searchIndex: 2,
        searchMenuSpan: 6,
        searchIcon: true,
        permissionBtn: {
            addBtn: 'start:act:model:add',
            editBtn: 'start:act:model:edit',
            viewBtn: 'start:act:model:info',
            delBtn: 'start:act:model:delete',
        },
        column: [
            {
                label: 'id',
                span: 12,
                prop: 'id',
                align: "left",
                editDisplay: false,
                addDisplay: false,
                hide: true
            },
            {
                label: '流程名称',
                prop: 'modelName',
                span: 24,
                search: true,
                searchModel: startSearchModel.LIKE_RIGHT,
                rules: [{
                    required: true,
                    trigger: "blur",
                    message: "请输入流程名称"
                }]
            },
            {
                label: '流程标识',
                span: 24,
                prop: 'modelKey',
                search: true,
                searchModel: startSearchModel.LIKE_RIGHT,
                editDetail: true,
                rules: [{
                    required: true,
                    trigger: "blur",
                    message: "请输入流程唯一标识"
                }]
            },
            {
                label: '流程类别',
                prop: 'modelCategory',
                span: 24,
                type: "select",
                search: true,
                dicUrl: `${baseUrl}/startActCategoryApi/listCategory`,
                props: {
                    label: 'actCategoryName',
                    value: 'actCategoryCode',
                },
                rules: [{
                    required: true,
                    trigger: "blur",
                    message: "请输入流程类别"
                }]
            },
            {
                label: '扩展参数1',
                prop: 'param1',
                span: 24,
                hide: true,
            },
            {
                label: '扩展参数2',
                prop: 'param2',
                span: 24,
                hide: true,
            },
            {
                label: '扩展参数3',
                prop: 'param3',
                span: 24,
                hide: true,
            },
            {
                label: '扩展参数4',
                prop: 'param4',
                span: 24,
                hide: true,
            },
            {
                label: '图标',
                row: true,
                accept: "image/*",
                prop: 'modelIcon',
                type: "upload",
                span: 24,
                limit: 1,
                listType: 'picture-card',
                action: uploadConfig.action,
                propsHttp: uploadConfig.propsHttp,
                rules: [{
                    required: false,
                    trigger: "blur"
                }]
            },
            {
                label: '当前版本',
                prop: 'modelVersion',
                span: 12,
                editDisplay: false,
                addDisplay: false
            },
            {
                label: '当前版本发布状态',
                prop: 'deployState',
                span: 12,
                editDisplay: false,
                addDisplay: false,
                dicData: [
                    {label: "待部署", value: 0},
                    {label: "已部署", value: 1}
                ]
            },
            {
                label: '已部署版本',
                prop: 'deployVersion',
                span: 12,
                editDisplay: false,
                addDisplay: false,
                formatter: (row, value, column) => {
                    if (value === 0) {
                        return "无"
                    }
                    return value
                }
            },
            {
                label: '最后修改时间',
                prop: 'lastUpdateTime',
                span: 12,
                type: 'datetime',
                valueFormat: 'YYYY-MM-DD HH:mm:ss',
                format: 'YYYY-MM-DD HH:mm:ss',
                editDisplay: false,
                addDisplay: false
            }
        ]
    }
}
